package com.caiguoping.yuv;

import android.graphics.Bitmap;

public class Test {

    static {
        System.loadLibrary("yuv");
    }

    public final static int FORMAT_ARGB_8888 = 32;

    public final static int FORMAT_NV21 = 12;

    public static native int ABGRToNV21(int width, int height, byte[] abgr, byte[] nv21);

    public static native int BGRAToARGB(int width, int height, byte[] bgra, byte[] argb);

    public static native int ARGBToBGRA(int width, int height, byte[] argb, byte[] bgra);

    public static native int NV21ToABGR(int width, int height, byte[] nv21, byte[] abgr);

    public static native int NV21ToI420(int width, int height, byte[] nv21, byte[] I420);

    public static native int I420Rotate(int width, int height, byte[] src, byte[] dst, int rotate);

    public static native int I420ToABGR(int width, int height, byte[] I420, byte[] abgr);

    public static native int bitmapToNv21(Bitmap bitmap, byte[] nv21);

    public static native int ARGBRotate(int width, int height, byte[] src, byte[] dst, int rotate);

    public static byte[] createByteBuff(int width, int height, int format) {
        return new byte[width * height * format / 8];
    }
}
